using System;
namespace Common.Environment
{
	public class OsEnviroment
	{
		public static string GetOsInfo()
		{
			OperatingSystem oSVersion = System.Environment.OSVersion;
			Version version = oSVersion.Version;
			string result = "";
			if (oSVersion.Platform == PlatformID.Win32Windows)
			{
				int minor = version.Minor;
				if (minor != 0)
				{
					if (minor != 10)
					{
						if (minor == 90)
						{
							result = "Me";
						}
					}
					else
					{
						result = ((version.Revision.ToString() == "2222A") ? "98SE" : "98");
					}
				}
				else
				{
					result = "95";
				}
			}
			else
			{
				if (oSVersion.Platform == PlatformID.Win32NT)
				{
					switch (version.Major)
					{
					case 3:
						result = "NT 3.51";
						break;
					case 4:
						result = "NT 4.0";
						break;
					case 5:
						if (version.Minor == 0)
						{
							result = "2000";
						}
						else
						{
							result = "XP";
						}
						break;
					case 6:
						if (version.Minor == 0)
						{
							result = "Vista";
						}
						else
						{
							result = "7";
						}
						break;
					}
				}
			}
			return result;
		}
		private static int GetOsArchitecture()
		{
            string environmentVariable = System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");
			return (string.IsNullOrEmpty(environmentVariable) || string.Compare(environmentVariable, 0, "x86", 0, 3, true) == 0) ? 32 : 64;
		}
	}
}
